//
//  FastNewsController.m
//  Theme
//
//  Created by 张鹏伟 on 15/8/20.
//  Copyright (c) 2015年 108. All rights reserved.
//

#import "FastNewsController.h"

@interface FastNewsController ()

@end

@implementation FastNewsController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"快讯";    
    self.view.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"ygColor"];
    
    _myView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, screenWidth-200, 300)];
    _myView.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"rgColor"];
    [self.view addSubview:_myView];
    
    _myLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 450, screenWidth, 21)];
    _myLab.text = @"切换主题";
    _myLab.textAlignment = NSTextAlignmentCenter;
    _myLab.textColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"mrColor"];
    [self.view addSubview:_myLab];
    
    //接收主题改变的通知
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeThemeNotificantion) name:ThemeChangeNotification object:nil];
    
    [self changeThemeNotificantion];
    // Do any additional setup after loading the view.
}

//改变主题的通知
- (void)changeThemeNotificantion{
    self.view.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"ygColor"];
    _myView.backgroundColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"rgColor"];
    _myLab.textColor = [[ConfigurationTheme shareInstance] getThemeColorWithName:@"mrColor"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
